

$(
		function ()
		{
			InitUpload.init(); 
		}
)



function open1()
{
	$('#myModal_D_id').modal();
}

var InitUpload=
{
		init:function ()
		{
			 var control = $("#input-id"); 
			 control.fileinput
			 ({
			        language: 'zh', //设置语言
			        uploadUrl:"/OrderSystem/ImgUpLoad.action", //上传的地址
			        allowedFileExtensions : ['jpg', 'png','gif'],//接收的文件后缀
			        showUpload: true, //是否显示上传按钮
			        showCaption: true,//是否显示标题
			        browseClass: "btn btn-primary", //按钮样式             
			        previewFileIcon: "<i class='glyphicon glyphicon-king'></i>", 
			        dropZoneEnabled : true,
			        enctype : 'multipart/form-data',
			        validateInitialCount : true,
			        showpreview:false,
			        //maxFileSize:10,//最大尺寸
			        //maxFileCount:1//允许上传的文件数
			 }); 
			 
			 
			 control.on
			 (	
					 "fileuploaded",
					 function(event, data, previewId, index) 
					 {
						 console.log(data.response[0].body.file_id);
						 document.getElementById("imgg").src="/OrderSystem/img/"+data.response[0].body.file_id;
						 document.getElementById("img_input").value=data.response[0].body.file_id;
						 
					 }
			 );
			 
		}
}

